package com.nbsaas.boot.order.data.entity;

import com.nbsaas.boot.code.annotation.FieldConvert;
import com.nbsaas.boot.code.annotation.FormAnnotation;
import com.nbsaas.boot.jpa.data.entity.AbstractEntity;
import lombok.Data;
import org.hibernate.annotations.Comment;

import javax.persistence.*;
import java.math.BigDecimal;

@org.hibernate.annotations.Table(appliesTo = "bs_order_item", comment = "订单明细")
@Data
@FormAnnotation(title = "订单明细")
@Entity
@Table(name = "bs_order_item")
public class OrderItem extends AbstractEntity {

    @JoinColumn(name = "order_id")
    @Comment("订单id")
    @FieldConvert
    @ManyToOne(fetch = FetchType.LAZY)
    private Order order;


    @Comment("商品id")
    private Long productId;

    @Comment("商品名称")
    private String productName;



    @Comment("父id")
    private Long parentId;

    @Comment("单价")
    private BigDecimal price;

    @Comment("商品数量")
    private BigDecimal num;

    @Comment("小计")
    private BigDecimal total;

    @Comment("总优惠金额")
    private BigDecimal totalDiscount;


    @Comment("实际付款金额")
    private BigDecimal actualAmount;
}
